export const tableMixin = {
    data() {
        return {
            page_no: 0,
            page_size: 10,
            form: {},
            tableLoading: false,
            tableData: [],
            total_size: 0,
        }
    },
    mounted() {
        console.log('fffffffffffff')
    },

    methods: {
        clickExport: async (exportFunc) => {
            if (!exportFunc) return
            const res = await exportFunc({ ...this.form, page_no: this.page_no, page_size: this.page_size })
            if (res.success) {
            } else {

            }
        },

        clickQuery: async (queryFunc) => {
            loading.value = true
            const data = await queryFunc({ ...this.form, page_no: this.page_no, page_size: this.page_size })
            if (data.success) {
                this.total_size = data.total
                this.tableData = data.dataList
                if (callBack) {
                    callBack({ data_list: data.dataList })
                }
            } else {
                this.total_size = 0
                this.tableData = []
                callBack && callBack({ data_list: [] })
            }
            loading.value = false
        },
    },
}
